<template>
  <div style="height: 100%;">
    <router-view v-slot="{ Component }">
      <keep-alive>
        <component :is="Component" />
      </keep-alive>
    </router-view>
    <Instrument @measureType="measureType"></Instrument>
  </div>
</template>
  
<script setup>
import { emitter } from "@/utils/events";
import measureUtil from "@/components/Instrument/measureUtils";
import Instrument from "@/components/Instrument/Measure" // 测量工具
// 监听地图是否加载完毕 mapOnload-当前页面路由name
let mapInstance, map3dMeasureUtil; // 量算函数
emitter.once("mapOnload", (map) => {
  mapInstance = map;
  map3dMeasureUtil = new measureUtil(mapInstance);
});

// 测量工具
function measureType(value) {
  map3dMeasureUtil.measureHandle(value)
}
</script>
  
<style scoped></style>